<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		
		<form name="xx">
			<input name="sj"  />
			
		</form>
	</body>
	
	<script>
	
		//window.onload=ymd();
	
		
		
		function ymd(){
			var yyr = '';
			
			var date  = new Date();
			var d  = date.getDate();
			var s = date.getSeconds()
			
			var ss='';
			ss = s<10?"0"+s:s;
			console.log(ss);
			console.log(typeof(s));
			
			yyr = ''+date.getFullYear()+'-'+(date.getMonth()+1)+'-'+d +" "+ date.getHours()+":"+date.getMinutes()+":"+ss;
			console.log(yyr);
			
			var obj =document.xx.sj;
			
			document.xx.sj.value=yyr;
		}
		
		ymd();
		//里面需要加'' 主要
		setInterval('ymd()',1000);
		
		//ymd();
	</script>
</html>
